const Sequelize = require('sequelize')

const {
    SQL_HOST,
    SQL_PORT,
    SQL_USER,
    SQL_PASSWORD,
    SQL_DB
} = require('../config/config_deafault')

const sequelize = new Sequelize(SQL_DB, SQL_USER, SQL_PASSWORD, {
    host: SQL_HOST,
    dialect: 'mysql',
    timezone: '+08:00',
    dialectOptions: {
        dateStrings: true,
        typeCast: true,
    }
})

// sequelize.authenticate().then(() => {
//     console.log('数据库连接成功');

// }).catch((error) => {
//     console.log(error);

// })
module.exports = sequelize